﻿<?php 
	if($_SERVER['REQUEST_URI'] == $root.'/trang-chu/' || $_SERVER['REQUEST_URI'] == $root."/"){		
		echo "<div class=\"hr\"><hr/></div>";
	}
	else {
		?>
		<div id="header-brands" align="center">
			<div class="menu-brands">
		<?
		if(isset($_GET['cid'])){
			$cid = intval($_GET['cid']);
			
			$c_id_cha;
			do{
				$rs = $db->query("SELECT c_id_cha FROM ".$prefix."loaisanpham where c_hienthi = 1 AND c_id = '".$cid."'");
				$row = $db->fetch_array($rs);
				$c_id_cha = $row[c_id_cha];
				if($c_id_cha != 0){
					$cid = $c_id_cha;
				}
			}while($c_id_cha != 0);
			
			$rs = $db->query("SELECT * FROM ".$prefix."loaisanpham where c_hienthi = 1 AND c_id_cha = '".$cid."'");
			if($db->num_rows($rs) != 0) {
				while($row = $db->fetch_array($rs)){
					$c_ten = stripcslashes($row[c_ten]);
					$c_id = $row[c_id];
					?>
						<div class="txt-menu">
							<a <? if($_SERVER['REQUEST_URI'] == $root."/danh-muc-san-pham/".$c_id."/".($myString->vietdecode($c_ten) )) { ?> class="selected" <? } else { ?> class="default" <? } ?> href="<?=$root?>/danh-muc-san-pham/<?=$c_id?>/<?=$myString->vietdecode($c_ten)?>"><?=$c_ten?></a>
						</div>
					<?
				}		
			}
		} 
		?>			
			</div>
		</div>
		<div id="header-brands-bottom"></div>
	<? }
?>
<div class="clearfix"></div>